import common.MCore;

import constraint.MConstraint;


public class Main {
	public static void main(String[] args) {
		MCore core = new MCore("test");
		
		core.addClass("A", false, null);
		core.addClass("B", false, core.getClass("A"));
		core.addClass("C", true, core.getClass("A"));
		core.addClass("D", false, core.getClass("C"));
		core.addClass("E", false, core.getClass("C"));
		
		core.defineObject("a1", core.getClass("A"));
		core.defineObject("a2", core.getClass("A"));
		core.defineObject("e1", core.getClass("E"));
		core.defineObject("e2", core.getClass("E"));
		
		core.addClassAttribute("ATT");
		
		core.initModel();
		
		core.addPredicate("PRED_1", "|A*| = |B|", core.createEq(core.getClass("A").getSelfCardinality(), core.getClass("B").getCardinality()));
		core.addPredicate("PRED_2", "|C| <= 5", core.createLeq(core.getClass("C").getCardinality(), core.createIntCst(5)));
		core.addPredicate("PRED_3", "|B| < |C|", core.createLt(core.getClass("B").getCardinality(), core.getClass("C").getCardinality()));

		core.addPredicate("PRED_4", "a1::A", core.createObjectClass(core.getObject("a1"), core.getClass("A")));
		
//		MConstraint csts[] = new MConstraint[2];
//		csts[0] = core.createLeq(core.createIntCst(0), core.getClassAttribute("ATT").getVariable());
//		csts[1] = core.createLeq(core.getClassAttribute("ATT").getVariable(), core.createIntCst(100));
//		core.addPredicate("PRED_5", "0 <= ATT <= 100", core.createAnd(csts));
		
		core.addPredicate("PRED_5a", "0 <= ATT", core.createLeq(core.createIntCst(0), core.getClassAttribute("ATT").getVariable()));
		core.addPredicate("PRED_5b", "ATT <= 100", core.createLeq(core.getClassAttribute("ATT").getVariable(), core.createIntCst(100)));
		
		core.addGeneratedConstraints();
		
		core.initVariables();
		
		System.out.println(core.toString());

		core.computeBounds();

		System.out.println(core.toString());
	}
}
